<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="ll.sms.util.SmsUtil"%>
<%@page import="ll.sms.util.AdminProperty"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="ll.sms.db.Transaction"%>
<%@page import="ll.sms.factory.BeanFactory"%>
<%@page import="ll.sms.dao.SmsAdminDAO"%>
<%@page import="ll.sms.pojo.SmsAdmin"%>
<%
String username = SmsUtil.sessionHelper(session,AdminProperty.auname);
if(StringUtils.isBlank(username) || !"admin".equals(username)){
return;
}
String channel = request.getParameter("adefaultchannel");

if(StringUtils.isBlank(channel)){
out.print( "{success:false,errors:{msg:'未选择通道'}}");
return;
}

Transaction.begin();
((SmsAdminDAO)BeanFactory.getBean(SmsAdminDAO.class)).setAdminDefaultChannel(channel.trim());
Transaction.commit();
SmsAdmin smsAdmin = (SmsAdmin)session.getAttribute("user");
smsAdmin.setAdefaultchannel(channel);
session.setAttribute("user",smsAdmin);
out.print("{success:true}");
%>
